<?php
namespace Admin\Controller;
use Common\Controller\AdminbaseController;
class VideoCommentController extends AdminbaseController {
	
	function _initialize() {
		parent::_initialize();
	}
	
	function index(){
		$page = $this->page(100, 20);
		$videoName = I("post.videoName", "");
		$content = I("post.content", "");
		$startTime = I("post.startTime", "");
		$endTime = I("post.endTime", "");
		$videoId = I("get.videoId", 0);
		
		$param = "beginRow=".$page->firstRow."&fetchRows=".$page->listRows."&videoName=".$videoName."&content=".$content;
		if(!empty($startTime)){
			$param .= "&startTime=".strtotime($startTime) * 1000;
		}
		if(!empty($endTime)){
			$param .= "&endTime=".strtotime($endTime) * 1000;
		}
		if(0 != $videoId){
			$videoName = I("get.videoName", "");
			$param .= "&videoId=".$videoId;
		}
		$result = $this->curl_http(C('video_url').'v_comment/getList?token='.$_SESSION["TOKEN"], $param);
		$this->assign("data", $result['ReturnData']);
		$page = $this->page($result['total'], 20);
		$this->assign("page", $page->show('Admin'));
		$this->assign("formParam", array('startTime'=>$startTime,'endTime'=>$endTime,'videoName'=>$videoName,'content'=>$content));
		$this->display();
	}
	
	function delete(){
		$commentId = I("get.commentId", 0);
		$status = 0;
		$postData = 'commentId='.$commentId;
		$result = $this->curl_http(C('video_url').'v_comment/delete?token='.$_SESSION["TOKEN"], $postData);
		if($result['Success']){
			$this->success("删除成功！", U("Admin/VideoComment/index"));
		}else{
			return $this->error($result['Message']);
		}
	}
}